package com.hlk.controller.article;

import com.hlk.pojo.bo.NewArticleBO;
import com.hlk.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.validation.Valid;
import java.util.Date;

/**
 * @author hlk
 * @version 1.0
 * @date 2020-12-30 15:03
 */
@Api(value = "文章业务的controller", tags = {"文章业务的controller"})
@RequestMapping("article")
public interface ArticleControllerApi {

    @PostMapping("createArticle")
    @ApiOperation(value = "用户发文")
    Result createArticle(@RequestBody @Valid NewArticleBO newArticleBO, BindingResult result);

    @PostMapping("queryMyList")
    @ApiOperation(value = "查询用户的所有文章列表")
    public Result queryMyList(@RequestParam String userId, @RequestParam String keyword, @RequestParam Integer status, @RequestParam Date startDate,
                              @RequestParam Date endDate, @RequestParam Integer page, @RequestParam Integer pageSize);

    @PostMapping("queryAllList")
    @ApiOperation(value = "管理员查询用户的所有文章列表")
    Result queryAllList(@RequestParam Integer status,
                        @ApiParam(name = "page", value = "查询下一页的第几页", required = false)
                        @RequestParam Integer page,
                        @ApiParam(name = "pageSize", value = "分页的每一页显示的条数", required = false)
                        @RequestParam Integer pageSize);

    @PostMapping("doReview")
    @ApiOperation(value = "管理员对文章进行审核通过或者失败")
    public Result doReview(@RequestParam String articleId, @RequestParam Integer passOrNot);

    @PostMapping("/delete")
    @ApiOperation(value = "用户删除文章")
    Result delete(@RequestParam String userId, @RequestParam String articleId);

    @PostMapping("/withdraw")
    @ApiOperation(value = "用户撤回文章")
    Result withdraw(@RequestParam String userId, @RequestParam String articleId);
}
